/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sbbs.springboot.sample3.demo;

import java.util.HashMap;
import java.util.Map;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试.
 *
 * @author Administrator
 *
 */
@RestController
@RequestMapping("/demo")
public class DemoController {

    /**
     * 返回demo数据: 请求地址：http://127.0.0.1:8080/demo/getDemo
     *
     * @return
     */
    @RequestMapping("/getDemo")
    public Demo getDemo() {
        Demo demo = new Demo();
        demo.setId(1);
        demo.setName("Hero啊此");
        return demo;
    }

    @RequestMapping("/getDataMap")
    public Map getDataMap() {
        Map demo = new HashMap();
        demo.put("a", "dataA");
        demo.put("b", "dataB");
        demo.put("c", 100);
        return demo;
    }

    @RequestMapping("/zeroException")
    public int zeroException() {
        return 100 / 0;
    }
}
